<template>
  <div class="soliciting">
    <header>
      <span class="logo">
        <img src="../img/2.gif" alt />
      </span>
      <span>房屋求租</span>
      <span class="return" @click="back()">
        <van-icon name="arrow-left" />
      </span>
    </header>
    <main>
      <van-dropdown-menu>
        <van-dropdown-item v-model="value1" :options="option1" />
        <van-dropdown-item v-model="value2" :options="option2" />
      </van-dropdown-menu>
      <div class="list" v-for="(item,index) in list" :key="index">
        <div class="up">
          <dl>
            <dt><img :src="item.head" alt=""></dt>
            <dd>{{item.name}}</dd>
          </dl>
          <p>{{item.tit}}</p>
        </div>
        <p>
          意向区域:{{item.city}}&emsp;
          意向价格:<span>{{item.price}}/月</span>&emsp;&emsp;
          <van-icon name="chat" @click="chat()"/>&nbsp;
          <van-icon name="phone" />
        </p>
      </div>
    </main>
  </div>
</template>

<script>
import axios from "../../ulis/request";
import { log } from "util";
export default {
  data() {
    return {
      list:[],
      value1: 0,
      value2: "a",
      option1: [
        { text: "房产类型", value: 0 },
        { text: "新款商品", value: 1 },
        { text: "活动商品", value: 2 }
      ],
      option2: [
        { text: "区域选择", value: "a" },
        { text: "好评排序", value: "b" },
        { text: "销量排序", value: "c" }
      ]
    };
  },
  created() {
    //调用函数
    this.getList()
  },
  methods: {
    //返回主页面
    back() {
      this.$router.push(`/`);
    },
    //列表渲染
    getList() {
      axios({
        url: "/api/solicitingList",
      }).then(res => {
        if (res.data.code === 1) {
          this.list = res.data.data;
        } else {
          this.$router.push(`/login`);
        }
      });
    },
    //进入聊天房间
    chat(){
      this.$router.push(`/chatRoom`)
    },
  }
};
</script>

<style>
.soliciting {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.soliciting header {
  width: 100%;
  height: 60px;
  background-color: #2997fb;
  text-align: center;
  line-height: 60px;
}

.soliciting header span {
  color: white;
  float: right;
  margin-right: 70px;
  vertical-align: middle;
}

.soliciting header .logo {
  float: right;
  /* margin-top: 8px; */
  margin-right: 10px;
  vertical-align: middle;
}

.soliciting header .return {
  float: left;
  margin-left: 30px;
  vertical-align: middle;
  margin-top: 3px;
}

.soliciting main {
  flex: 1;
  overflow-y: auto;
  background-color: #f3f3f3;
}

.soliciting main .list {
  width: 100%;
  height: 150px;
  background-color: white;
  margin-bottom: 8px;
}

.soliciting main .list .up {
  width: 90%;
  height: 64%;
  border-bottom: 1px solid #ccc;
  margin: 0 auto;
}

.soliciting main .list .up dl {
  width: 100%;
  height: 50px;
  display: flex;
}

.soliciting main .list .up dl dt {
  width: 50px;
  height: 100%;
  border: 1px solid #ccc;
  border-radius: 50%;
  vertical-align: middle;
  margin-top: 10px;
}

.soliciting main .list .up dl dt img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.soliciting main .list .up dl dd {
  margin-top: 8%;
  margin-left: 4%;
  font-size: 18px;
}

.soliciting main .list .up > p {
  margin-top: 18px;
}

.soliciting main .list > p{
  margin-left: 5%;
  /* vertical-align: middle; */
  margin-top: 15px;
}

.soliciting main .list > p span{
  color: coral;
}

.soliciting main .list > p i {
  display: inline-block;
  width: 30px;
  height: 30px;
  background: rgb(252, 224, 235);
  border-radius: 50%;
  text-align: center;
  line-height: 30px;
  font-size: 20px;
  color: rgb(255, 128, 166);
  vertical-align: middle;
}
</style>